Class Web Page

R resource page


1. GARCH model


  • GARCH(1,1) model \[ \begin{align} Y_t &= \sigma_t e_t \hspace10mm e_t \sim_{iid} N(0,1) \\\\ \sigma_t^2 &= \omega + \alpha Y_{t-1}^2 + \beta \sigma^2_{t-1} \end{align} \]



Conditional Mean and Var of GARCH

  • Conditional Mean: \(0\)

  • Conditional Variance : \(\sigma_t^2\)



Ex: Daily SPY

Daily Price of SP500 ETF (SPY) from Jan 02 2000 to Dec 31 2014

## Warning in if (!header) rlabp <- FALSE: the condition has length > 1 and
## only the first element will be used
## Warning in if (header) {: the condition has length > 1 and only the first
## element will be used
##   ixDay      Date   Weekday X SPY.Open SPY.High SPY.Low SPY.Close
## 1     1  1/3/2000    Monday 1   148.25   148.25  143.88    145.44
## 2     2  1/4/2000   Tuesday 2   143.53   144.06  139.64    139.75
## 3     3  1/5/2000 Wednesday 3   139.94   141.53  137.25    140.00
## 4     4  1/6/2000  Thursday 4   139.62   141.50  137.75    137.75
## 5     5  1/7/2000    Friday 5   140.31   145.75  140.06    145.75
## 6     6 1/10/2000    Monday 6   146.25   146.91  145.03    146.25
##   SPY.Volume SPY.Adjusted
## 1    8164300       110.33
## 2    8089800       106.01
## 3   12177900       106.20
## 4    6227200       104.50
## 5    8066500       110.57
## 6    5741700       110.94

##       AIC       BIC       SIC      HQIC 
## -6.470319 -6.465360 -6.470321 -6.468556

##   B-L test H0: the sereis is uncorrelated
##   M-L test H0: the square of the sereis is uncorrelated
##   J-B test H0: the sereis came from Normal distribution
##   SD         : Standard Deviation of the series
##      BL15 BL20 BL25  ML15  ML20 JB    SD
## [1,]    0    0    0 0.719 0.855  0 1.001



Write \(\sigma^2_t\) using \(Y_t^2\)


  • Starting with the definition of GARCH(1,1),

    \[ \begin{align} \sigma_t^2 &= \omega + \alpha Y_{t-1}^2 + \beta \sigma^2_{t-1} \\\\ &= \omega + \alpha Y_{t-1}^2 + \beta \Big(\omega + \alpha Y_{t-2}^2 + \beta \sigma^2_{t-2} \Big)\\ \\ &= \omega + \beta \omega + \alpha Y_{t-1}^2 + \beta \alpha Y_{t-2}^2 + \beta^2 \sigma^2_{t-2} \\ \\ &= \omega + \beta \omega + \alpha Y_{t-1}^2 + \beta \alpha Y_{t-2}^2 + \beta^2 \Big(\omega + \alpha Y_{t-3}^2 + \beta \sigma^2_{t-3} \Big) \\ \\ &= \omega + \beta \omega + \beta^2 \omega + \alpha Y_{t-1}^2 + \beta \alpha Y_{t-2}^2 + \beta^2 \alpha Y_{t-3}^2 + \beta^3 \sigma^2_{t-3} \end{align} \]

  • Continuing, we get \[ \begin{align} &= \omega (1 + \beta + \beta^2 + \cdots ) + \alpha \sum_{i=0}^k \beta^i Y_{t-1-i}^2 + \beta^{k+1} \sigma^2_{t-1-k} \\\\ &= \frac{\omega}{1-\beta} + \alpha \sum_{i=0}^\infty \beta^i Y_{t-1-i}^2 \end{align} \]

  • That means if we keep going, we can write \[ \sigma_t^2 \hspace3mm = \hspace3mm \frac{\omega}{1-\beta} + \alpha \sum_{i=0}^\infty \beta^i Y_{t-1-i}^2 \]

  • We will use the truncated and estimated version of this, \[ \hat \sigma_t^2 \hspace3mm = \hspace3mm \frac{\hat \omega}{1- \hat \beta} \hspace3mm + \hspace3mm \hat \alpha \sum_{i=0}^{t-1} \hat \beta^i Y_{t-1-i}^2 \]



Residuals of GARCH process

  • GARCH(1,1) says, \[ Y_t \hspace3mm = \hspace3mm \sigma_t e_t \]

  • Using observation \(\{Y_1, \ldots, Y_n\}\), the residuals are \[ \hat e_t = Y_t/ \hat \sigma_t \]



Quasi-MLE

  • Quasi-Maximum Likelihood Estimator, means we will use MLE for normal errors, even in the case of non-normality. Theoretically, for GARCH parameters, it is shown that Normal MLE is still consistent under non-normal errors.


Importatnce of Conditional Distribution


\[ \begin{align} Y_t &= \sigma_t e_t \hspace{10mm} e_t \sim_{iid} N(0,1)\\\\ \sigma_t^2 &= \omega + \alpha Y_{t-1}^2 + \beta \sigma^2_{t-1} \end{align} \]

  • [Conditonal distribution] \(=\) [Distribution of \(e_t\)]

  • Guessing correct distribution for \(e_t\) is very important in GARCH parameter estimation.



Built-in distributions



Simulation Study

True parameter (.024, .1, .8)

  • True conditional distribution: Normal Estimated using: Normal

  • True conditional distribution: std(5) Estimated using: Normal

  • True conditional distribution: sged(skew=.7, shape=1.45) Estimated using: Normal

  #--- Simulation showing how error distribution affect parameter estimation in GARCH(1,1) ---
  n   <- 1000
  itt <- 1000
  theta <- c(.024, .1, .8)
  
  Param11 <- matrix(rep(0,3*itt), itt, 3)
  for (i in 1:itt) {
  
    spec <- garchSpec(model = list(omega=theta[1], alpha=theta[2], beta=theta[3]),  cond.dist="norm")
    x    <- garchSim(spec, n = n, extended=FALSE)
  
    est2 <-  garchFit(~ garch(1,1), data=x, cond.dist="norm",  include.mean = FALSE, trace = FALSE)
    Param11[i,] <- coef(est2)
  }
  
  Param12 <- matrix(rep(0,3*itt), itt, 3)
  for (i in 1:itt) {
  
    spec <- garchSpec(model = list(shape=5, omega=theta[1], alpha=theta[2], beta=theta[3]),  cond.dist="std")
    x     <- garchSim(spec, n = n, extended=FALSE)
  
    est2 <-  garchFit(~ garch(1,1), data=x, cond.dist="norm",  include.mean = FALSE, trace = FALSE)
    Param12[i,] <- coef(est2)
  }

  Param13 <- matrix(rep(0,3*itt), itt, 3)
  for (i in 1:itt) {
  
    spec <- garchSpec(model = list(skew=.9,  shape=1.45, omega=theta[1], alpha=theta[2], beta=theta[3]),  cond.dist="sged")
    x    <- garchSim(spec, n = n, extended=FALSE)
  
    est2 <-  garchFit(~ garch(1,1), data=x, cond.dist="norm",  include.mean = FALSE, trace = FALSE)
    Param13[i,] <- coef(est2)  
  }

  layout(matrix(1:9, 3, 3, byrow=T))
  hist(Param11[,1], 10, xlim=c(0,.5)); hist(Param11[,2], 10, xlim=c(0,.5)); hist(Param11[,3], xlim=c(0.4,1), breaks=10)
  hist(Param12[,1], 10, xlim=c(0,.5)); hist(Param12[,2], 10, xlim=c(0,.5)); hist(Param12[,3], xlim=c(0.4,1), breaks=10)
  hist(Param13[,1], 10, xlim=c(0,.5)); hist(Param13[,2], 10, xlim=c(0,.5)); hist(Param13[,3], xlim=c(0.4,1), breaks=10)

  P11 <- (Param11 - t(matrix(theta, 3, itt) ))^2
  P12 <- (Param12 - t(matrix(theta, 3, itt) ))^2
  P13 <- (Param13 - t(matrix(theta, 3, itt) ))^2
  
  apply(P11, 2, mean)
  apply(P12, 2, mean)
  apply(P13, 2, mean)
  
  apply(P11, 2, mean)/apply(P11, 2, mean)
  apply(P12, 2, mean)/apply(P11, 2, mean)
  apply(P13, 2, mean)/apply(P11, 2, mean)

Results



Stationarity Cond’n for GARCH

  • GARCH(1,1) is weakly stationary if \[ E( \log(\beta + \alpha e_t^2)) < 0 \]

  • This is satisfied if \[ \alpha + \beta < 1. \]






2. Predicting \(\sigma_t\)


  • How well can GARCH predict \(\sigma_t\) of the future?

Using Simulated Data

  • See how closely true sigma is estimated and predicted, using simulated GARCH
## Warning in if (extended) ans else ans[, "garch"]: the condition has length
## > 1 and only the first element will be used

##                sigma       ..2
## 2015-07-14 0.9844680 1.7773189
## 2015-07-15 0.8719402 1.0198346
## 2015-07-16 0.8528739 0.9322072
## 2015-07-17 0.9465185 1.0167695
## 2015-07-18 0.9430606 1.0033031
## 2015-07-19 1.1075998 1.1624516

##    meanForecast meanError standardDeviation
## 1             0  1.061806          1.061806
## 2             0  1.267963          1.267963
## 3             0  1.411732          1.411732
## 4             0  1.517237          1.517237
## 5             0  1.596835          1.596835
## 6             0  1.657922          1.657922
## 7             0  1.705340          1.705340
## 8             0  1.742442          1.742442
## 9             0  1.771642          1.771642
## 10            0  1.794720          1.794720
## [1] 1.061806



Using SPX

  • See how close estimated sigma and rolling predicted sigma, using real data.
## [1] "GSPC"

## [1] 1007



More Examples

  • Cryer : CREF stock values

  • Shumway : NYSE us GNP

  • Cowpertwait : SP500, Southern hem Temp.